package com.mp3s.dc;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import com.mp3s.dc.model.XMLService;

@SpringBootApplication
public class DiskShareApp {
	private final XMLService configService;
	
	public DiskShareApp(XMLService cfgService) {
        this.configService = cfgService;
		
		// 读取外部 XML 文件
		String filePath = "/home/mp3s/ds/ds.xml"; // 替换为实际路径
		filePath = "ds.xml";
		try {
			String xml = configService.parseXmlFile(filePath);
			System.out.println(xml);
		} catch (Exception e) {
			// TODO: handle exception
		}
    }

	public static void main(String[] args) throws Exception {
		SpringApplication.run(DiskShareApp.class, args);
	}

	@Component
	public class DSApplicationListener implements ApplicationListener<ApplicationReadyEvent> {

		@Override
		public void onApplicationEvent(@SuppressWarnings("null") ApplicationReadyEvent event) {			
			// System.out.println("Spring Boot 应用已经启动完毕！");			
		}
	}


}


